package com.gaoyang.service;

import com.gaoyang.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * Created by gaoyang on 2017/6/1.
 */
@Service
public class UserService {

    public User getUser(String name){
        User user = new User();
        user.setName(name);
        user.setAge(20);
        user.setDate(new Date());
        return user;
    }

    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    public String getRedisString(String key) {
        stringRedisTemplate.opsForValue().set(key, "111");
        String aaa = stringRedisTemplate.opsForValue().get(key);
        System.out.println(aaa);
        return aaa;
    }
}
